

function dialog_hide() {
    $(".resetpass_dialog").hide();
    $(".login_window").show();
}

function dialog_hideAndRefresh() {
    $(".resetpass_dialog").hide();
    $(".login_window").show();
    window.location.href = "/index.php";
}

function dialog_show() {
    $(".resetpass_dialog").show();
    $(".login_window").hide();
}

var isReset = false;
$(".error_message").hide();
//比对验证码
var curentCode = 0;
var curentPhone = 0;
function checkVerificationCode(){
    if (!isReset){
        var phone = $(".input_1").val();
        var verification_code = $(".input_2").val();

        if (!checkPhone(phone)){
            $(".error_message").html("请输入正确的手机号码!");
            $(".error_message").show();
            return;
        }

        if (verification_code.length == 0){
            $(".error_message").html("验证码不能为空!");
            $(".error_message").show();
            return;
        }

        $.getJSON("/api.php?action=api_checkVerificationCode",{"phone":phone,"verification_code":verification_code},function(res) {
            if (res.code == 0){
                //比对成功
                $(".error_message").hide();

                curentCode = verification_code;
                curentPhone = phone;

                $(".input_1").removeAttr("placeholder");
                $(".input_1").val("");
                $(".input_2").removeAttr("placeholder");
                $(".input_2").val("");
                $(".input_2").css("width","384px");
                $(".get_verificationCode").hide();


                $(".phone_underline").css("height","2px");
                $(".phone_underline").css("background-color","#5dabe8");

                $(".reset_underline").css("height","4px");
                $(".reset_underline").css("background-color","#fff");

                $(".password_hint").show();
                $(".password_hint_two").show();
                isReset = true;

                $(".error_message").hide();
            }else {
                //比对失败
                $(".error_message").html(res.msg);
                $(".error_message").show();
            }
        });
    }else {
        if ($(".input_1").val().length != 0 && $(".input_2").val() != 0){
            if ($(".input_1").val() == $(".input_2").val()){
                var formData = new FormData();
                formData.append("newpass",$(".input_1").val());
                formData.append("phone",curentPhone);
                formData.append("verification_code",curentCode);
                $.ajax({
                    url:"/api.php?action=api_resetPass",
                    type:"POST",
                    cache:false,
                    data:formData,
                    processData:false,
                    contentType:false,
                    dataType:"json",
                    //发送前调用
                    beforeSend:function(){
                    },
                    //成功
                    success:function(result){
                        if(result.code == 0){
                            //修改完成,展现完成页

                            $(".error_message").hide();

                            //头部
                            $(".title_div_1").hide();
                            $(".title_div_2").hide();
                            $(".dialog_title").css("background-image","url(../images/login/reset.png)");
                            $(".dialog_title").css("background-size","686px 214px");

                            //中部
                            $(".password_hint").hide();
                            $(".password_hint_two").hide();
                            $(".input_1").hide();
                            $(".input_2").hide();
                            $(".dialog_middle").append("<div style='color: #87ba4d;font-size: 26px;text-align: center;position: relative;top: 30%;transform: translateY(-30%);'>密码重置成功!</div>");
                            $(".dialog_middle").append("<div style='color: #87ba4d;font-size: 14px;text-align: center;position: relative;top: 50%;transform: translateY(-50%);'>为保证您账号安全,请返回首页重新登录!</div>");

                            //尾部
                            $(".dialog_next").hide();

                            $(".dialog_bottom").append('<div style="border-bottom-left-radius: 8px;border-bottom-right-radius: 8px;font-size: 18px;color: #469ee3;height: 74px;width: 100%;line-height: 74px;text-align: center;border-top: 1px solid #d2ebff">'
                                +'<button onclick="dialog_hideAndRefresh()" style="background-color: #3e8ffe;width: 210px;height: 48px;border-radius: 10px;color: white;position: relative;font-size: 16px;margin: 0 auto;position: relative;top: 50%;transform: translateY(-50%);">登录</button>'
                                +'</div>');
                        }else{
                            //修改失败,清空数据
                            $(".error_message").html("修改密码失败,请联系管理员!");
                            $(".error_message").show();
                        }
                    },
                    //失败
                    error:function(result){
                        $(".error_message").html("登录失败,请检查网络连接后重试!");
                        $(".error_message").show();
                    }
                });
            }else {
                $(".error_message").html("两次输入的密码必须一致!");
                $(".error_message").show();
            }
        }else {
            $(".error_message").html("密码不能为空!");
            $(".error_message").show();
        }
    }
}

//倒计时逻辑
var countdown=60;
function settime(obj) {
    if (countdown == 0) {
        obj.removeAttribute("disabled");
        obj.value="验证码";
        countdown = 60;
        $(".get_verificationCode").css("color","#fff");
        $(".get_verificationCode").css("background-color","#4e99ff");
        return;
    }
    else {
        obj.setAttribute("disabled", true);
        obj.value="重新发送(" + countdown + ")";
        countdown--;
    }

    setTimeout(function() {settime(obj) },1000)
}

//获取验证码
function getVerificationCode(obj) {
    var phone = $(".input_1").val();

    if (!checkPhone(phone)){
        $(".error_message").html("请输入正确的手机号码!");
        $(".error_message").show();
        return;
    }

    //调用
    $.getJSON("/api.php?action=api_getVerificationCode",{"phone":phone},function(res) {
        if (res.code == 0){
            //获取成功,成功后开启倒计时
            $(".get_verificationCode").css("color","#666");
            $(".get_verificationCode").css("background-color","#dddddd");
            settime(obj);
        }else {
            //获取失败
            $(".error_message").html("获取失败,请检查网络连接后重试!");
            $(".error_message").show();
        }
    });
}


//正则验证
function checkPhone(phone) {
    if(/^1\d{10}$/.test(phone)){
        return true;
    }else {
        return false;
    }
}

//点击登录
function login(){
    //逻辑为调用php登录接口,验证通过后返回一个登陆成功页面的链接
    var username = $(".login_username_text").val();
    var password = $(".login_password_text").val();

    //验证
    /*if (!checkPhone($(".login_username_text").val())){
        $(".login_errorMessage").html("请填写正确的手机号码!");
        $(".login_errorMessage").show();
        return;
    }*/

    if (username.length == 0 || password.length == 0){
        $(".login_errorMessage").html("账号或密码不能为空!");
        $(".login_errorMessage").show();
        return;
    }
    //var baseUrl = "http://118.89.229.30/zhengxie_web/html/api.php?action=api_login";

    var formData = new FormData();
    formData.append("username",username);
    formData.append("password",password);
    //填充参数
    $.ajax({
        url:"/api.php?action=api_login",
        type:"POST",
        cache:false,
        data:formData,
        processData:false,
        contentType:false,
        dataType:"json",
        //发送前调用
        beforeSend:function(){
        },
        //成功
        success:function(result){
            if (result.code == 0){
                //此处链接不是活动的,默认跳转首页
                window.location.href = "/index.php?action=main";
            }else {
                $(".login_errorMessage").html(result.msg);
                $(".login_errorMessage").show();
            }
        },
        //失败
        error:function(result){
            $(".login_errorMessage").html("请检查网络连接后重试!");
            $(".login_errorMessage").show();
        }
    });
}


//新建提案
function createProposal(){
    var id = $('.userid_flag').attr('id');
    //提案人
    var tianren = $('.tianren').val();
    //附议人
    var fuyiren = $('.fuyiren').val();
    //提案内容
    var tianneirong = '';
    //提案建议
    var tianjianyi = '';
    $('.redactor-editor').each(function (n) {
        if(n == 0){
            tianneirong = $(this).html();
        }else {
            tianjianyi = $(this).html();
        }
    });
    //案由
    var anyou = $('.anyou').val();
    //提案类型
    var select_1 = $('.select_1').text();
    switch (select_1){
        case '经济类':
            select_1 = 1;
            break;
        case '文教体卫':
            select_1 = 2;
            break;
        case '政法统战政协':
            select_1 = 3;
            break;
    }

    //届次
    var select_2 = $('.select_2').text();

    /*alert('提案人:' + tianren + "||"
        +'附议人:' + fuyiren + "||"
        +'提案内容:' + tianneirong + "||"
        +'提案建议:' + tianjianyi + "||"
        +'案由:' + anyou + "||"
        +'提案类型:' + select_1 + "||"
        +'届次:' + select_2 + "||");*/

    //验证必须字段
    if (tianren.length == 0 ||  tianneirong.length == 0 || tianjianyi.length == 0 || anyou.length == 0 || select_1.length == 0 || select_2.length == 0){
        $('.xinjian_error_dialog').css('visibility','visible');
        $('.xinjian_error_dialog').html('所有带*的字段必须填写!');
        setTimeout(function() {
            $('.xinjian_error_dialog').css('visibility','hidden');
        },1000);
    }else {
        //验证文件上传
        var path = $(".mobileupload")[0].files;
        if (path.length != 0){
            //有文件
            var formData = new FormData();
            var names = '';
            for(var i= 0,name;i<path.length;i++){
                name = path[i].name.split('.')[0];
                formData.append(name, path[i]);
                if (i == path.length-1){
                    names += name;
                }else {
                    names += name + ',';
                }
            }
            formData.append('info',names);

            $.ajax({
                url: "/api.php?action=api_uploadFile",
                type: 'POST',
                cache: false,
                data: formData,
                processData: false,
                contentType: false,
                dataType: 'json',
                //发送前调用
                beforeSend: function(){
                    $('.xinjian_error_dialog').css("visibility","visible");
                },
                //成功
                success: function(result)
                {
                    //json解析
                    if (result.code == 1){
                        $('.xinjian_error_dialog').html("上传失败!");
                    }else {
                        //这里不进行再次拼接

                        //获取文件信息
                        var data = result.data;
                        var file_id = '';
                        for (var i=0;i<data.length;i++){
                            if (i==0){
                                file_id += data[i].id;
                            }else {post
                                file_id += ("," + data[i].id);
                            }
                        }

                        //继续调用参数上传接口
                        $.post("/api.php?action=api_createProposal",{
                            "tianren":tianren,
                            "fuyiren":fuyiren,
                            "tianneirong":tianneirong,
                            "tianjianyi":tianjianyi,
                            "anyou":anyou,
                            "tiantype":select_1,
                            "jieci":select_2,
                            "fileid":file_id,
                            "userId":id
                        },function(res) {
                            if (res.code == 0){
                                $('.xinjian_dialog').show();
                            }else {
                                $('.xinjian_error_dialog').html(res.msg);
                            }
                        },'json');
                    }
                },
                //失败
                error: function (result) {
                    $('.xinjian_error_dialog').html("上传错误!");
                },
                //进度
                xhr: function(){
                    var xhr = $.ajaxSettings.xhr();
                    if(onprogress && xhr.upload) {
                        xhr.upload.addEventListener("progress" , onprogress, false);
                        return xhr;
                    }
                }
            });

            //输出进度
            function onprogress(evt) {
                var loaded = evt.loaded;
                var tot = evt.total;
                $('.xinjian_error_dialog').html("正在上传:"+(Math.floor(100 * loaded / tot) + '%'));
            }

        }else {
            //无文件,直接调用新建接口

            $.post("/api.php?action=api_createProposal",{
                "tianren":tianren,
                "fuyiren":fuyiren,
                "tianneirong":tianneirong,
                "tianjianyi":tianjianyi,
                "anyou":anyou,
                "tiantype":select_1,
                "jieci":select_2,
                "userId":id
            },function(res) {
                if (res.code == 0){
                    $('.xinjian_dialog').show();
                    $('.successMessage').html("《" + res.data.anyou + "》提案,于" + res.data.createTime + "提交成功!");
                }else {
                    $('.xinjian_error_dialog').html(res.msg);
                    $('.xinjian_error_dialog').css("visibility","visible");
                }
            },'json');
        }
    }
}

function switchDialog(){
    $('.commitDialog').hide();
    $('.successDialog').show();
}


//审查提案
function updateProposalState() {
    //审查状态  1为通过立案  2为不立案
    var isLian = 0;
    //重点提案  1为确定为重点提案  2为不是重点提案
    var isZhongdian = 0;
    //承办单位
    var chengbandanwei = $('.chengbandanwei').val();
    //审查意见
    var shenchayijian = $('.shenchayijian').val();
    //操作人id
    var id = $('.userid_flag').attr('id');
    //提案id
    var proposalNum = $('.proposalNum').attr('id');

    if ($('.lian').is(':checked')){
        isLian = 1;
        //为true,继续获取重点提案和承办单位
        if ($('.shi').is(':checked')){
            isZhongdian = 1;
        }else {
            isZhongdian = 2;
        }

        if (chengbandanwei.length == 0 || shenchayijian.length == 0){
            alert('必须填写承办单位和审查意见');
            return;
        }
    }else {
        //为false,获取审查意见
        isLian = 2;

        if (shenchayijian.length == 0){
            alert('必须填写审查意见');
            return;
        }
    }



    /*alert(
        "operatetype:" + isLian + "<br>"
        +"isZhongdian:" + isZhongdian + "<br>"
        +"chengbandanwei:" + chengbandanwei + "<br>"
        +"remarks:" + shenchayijian + "<br>"
        +"userid:" + id + "<br>"
        +"proposalid:" + proposalNum + "<br>"
    );*/

    $.getJSON("/api.php?action=api_updateProposalState",{
        "operatetype":isLian,
        "isZhongdian":isZhongdian,
        "chengbandanwei":chengbandanwei,
        "remarks":shenchayijian,
        "userid":id,
        "proposalid":proposalNum},
        function(res) {
        if (res.code == 0){
            switchDialog();
        }else {
            alert(res.msg);
        }
    });
}


//交办提案
function updateProposalStateToJiaoBan(){
    var zhuban = $(".zhuban").val();
    //提案id
    var proposalNum = $('.proposalNum').attr('id');
    //操作人id
    var id = $('.userid_flag').attr('id');

    if (zhuban.length == 0){
        alert('主办单位必须填写!')
        return;
    }

    if ($('.xieban').val().length != 0){
        var xieban = $('.xieban').val();
        $.getJSON("/api.php?action=api_updateProposalStateToJiaoBan",
            {"zhuban":zhuban,
             "xieban":xieban,
             "proposalId":proposalNum,
             "userId":id},
            function (res) {
                if (res.code == 0){
                    switchDialog();
                }else {
                    alert(res.msg);
                }
            });
    }else {
        $.getJSON("/api.php?action=api_updateProposalStateToJiaoBan",
            {"zhuban":zhuban,
                "proposalId":proposalNum,
                "userId":id},
            function (res) {
                if (res.code == 0){
                    switchDialog();
                }else {
                    alert(res.msg);
                }
            });
    }
}

//接收提案
function proposalReceive() {
    //操作人id
    var id = $('.userid_flag').attr('id');
    //提案id
    var proposalNum = $('.proposalNum').attr('id');
    var isbanli = 0;// 1为办理  2为不在办理范围
    if ($('.banli').is(':checked')){
        isbanli = 1;
        //判断是否有原因
        var yuanyin =  $('.yuanyin').val();
        if (yuanyin.length == 0){
            //没有
            $.getJSON('/api.php?action=api_proposalReceive',{'userId':id,'proposalId':proposalNum,'isbanli':isbanli},function(res){
                if (res.code == 0){
                    $('.commitDialog').hide();
                    $('.fanhui').click(function (){window.location.href = '?action=banli&proposalID='+res.data});
                    $('.successDialog').show();
                }else {
                    alert(res.msg);
                }
            });
        }else {
            //有
            $.getJSON('/api.php?action=api_proposalReceive',{'userId':id,'proposalId':proposalNum,'isbanli':isbanli,'yuanyin':yuanyin},function(res){
                if (res.code == 0){
                    $('.commitDialog').hide();
                    $('.fanhui').click(function (){window.location.href = '?action=banli&proposalID='+res.data});
                    $('.successDialog').show();
                }else {
                    alert(res.msg);
                }
            });
        }
    }else {
        isbanli = 2;
        //判断是否有原因
        var yuanyin =  $('.yuanyin').val();
        if (yuanyin.length == 0){
            //没有
            alert('必须填写原因!');
            return;
        }else {
            //有
            $.getJSON('/api.php?action=api_proposalReceive',{'userId':id,'proposalId':proposalNum,'isbanli':isbanli,'yuanyin':yuanyin},function(res){
                if (res.code == 0){
                    $('.commitDialog').hide();
                    $('.fanhui').click(function (){window.location.href = '?action=jiaoban'});
                    $('.successDialog').show();
                }else {
                    alert(res.msg);
                }
            });
        }
    }
}

//提交反馈
function commitFeedback() {
    //操作人id
    var id = $('.userid_flag').attr('id');
    //提案id
    var proposalNum = $('.proposalNum').attr('id');
    //具体建议
    var jutijianyi = $('.feedbackcontent').val();
    //是否满意
    var isManyi = 0; // 1满意  2基本满意 3不满意
    if ($('.manyi').is(':checked')){
        isManyi = 1;
    }
    else if ($('.jibenmanyi').is(':checked')){
        isManyi = 2;
    }
    else {
        isManyi = 3;
    }
    //alert("操作人id:"+id + "||" + "提案id:" + proposalNum + "||" + "具体建议:" + jutijianyi + "||" + "是否满意:" + isManyi);
    $.getJSON('/api.php?action=api_commitFeedback',{
        'userId':id,
        'proposalId':proposalNum,
        'jutijianyi':jutijianyi,
        'isManyi':isManyi
    },function (res) {
        if (res.code == 0){
            //成功
            switchDialog();
        }else {
            //失败
            alert(res.msg);
        }
    });

}

var lastMark = '';
var mycurentpage = 0;
//获取我的列表数据
function getMyDataList(action,last,page){
    if (page.length != 0){
        curentPage = page;
    }
    var mark = '';
    if (action.length == 0){
        mark = $(".mark").attr('id');
    }else {
        if (action == 'next'){
            if(++curentPage <= maxPage){
                if (last.length != 0){
                    mark = lastMark;
                }else {
                    window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
                }
            }else {
                --curentPage;
                return;
            }
        }else if (action == 'last'){
            if (curentPage > 1){
                curentPage--;
                if (last.length != 0){
                    mark = lastMark;
                }else {
                    window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
                }
            }else if (curentPage == 1){
                if (last.length != 0){
                    mark = lastMark;
                }else {
                    mark = 'suoyou';
                }
            }else {
                return;
            }
        }else {
            mark = action;
        }
    }

    switch (mark){
        case 'suoyou':
            $('.select').html('所有提案');
            break;
        case 'shencha':
            $('.select').html('审查提案');
            break;
        case 'jiaoban':
            $('.select').html('交办提案');
            break;
        case 'banli':
            $('.select').html('办理提案');
            break;
        case 'yiban':
            $('.select').html('已办提案');
            break;
    }


    $.getJSON("/api.php?action=api_getMyTiAnDataList",{
        "mark":mark,
        "curentPage":curentPage
    },function(res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();

        var jsonStr = res;
        if (jsonStr.code == 0 && jsonStr.data.length != 0){

            //有数据,添加列表
            if (mark == 'daifankui'){
                $(".datalist").append(
                    "<div style='height: 10%;background-color: #f2f7fe;'>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                    +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                    +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >主办单位</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                    +"</div>");
            }else {
                $(".datalist").append(
                    "<div style='height: 10%;background-color: #f2f7fe;'>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                    +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                    +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提交时间</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >办理进度</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                    +"</div>");
            }
            var bianhao = '';
            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {
                var type = '';
                switch (t.type){
                    case '1':
                        type = '经济类';
                        break;
                    case '2':
                        type = '文教体卫';
                        break;
                    case '3':
                        type = '政法统战政协';
                        break;
                }

                var progress = '';
                switch (t.state){
                    case '1':
                        progress = '待审查';
                        break;
                    case '2':
                        progress = '未立案';
                        break;
                    case '3':
                        progress = '待交办';
                        break;
                    case '4':
                        progress = '办理中';
                        break;
                    case '5':
                        progress = '待反馈';
                        break;
                    case '6':
                        progress = '办完结';
                        break;
                }

                var pinjie ='';
                curentPage > 1? pinjie=curentPage-1:'';

                //拼接列表
                if (number % 2 == 0){
                    if (curentPage > 1){
                        (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                    }else {
                        bianhao = pinjie+(number+1);
                    }
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: white;'>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                        +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }else {
                    if (curentPage > 1){
                        (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                    }else {
                        bianhao = pinjie+(number+1);
                    }
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: #f7f7f7;'>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                        +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }
            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");
            maxPage = Math.ceil(jsonStr.size/10);
            lastMark = mark;
            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $('.datalist_item').each(function (n) {
                $(this).click(function () {
                    if (lastMark.length != 0){
                        getMyDataList(lastMark,lastMark,(n+1));
                    }
                });
            });

            $(".tableft").click(function () {
                getMyDataList('last',lastMark,curentPage);
            });
            $(".tabright").click(function () {
                getMyDataList('next',lastMark,curentPage);
            });

        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}

//获取列表数据
var maxPage = 0;
function getDataList(action,type){
    var curentPage = $('.datalist').attr('id');
    var mark = '';
    if (action.length == 0){
        mark = $(".mark").attr('id');
    }else {
        if (action == 'next'){
            if(++curentPage <= maxPage){
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                --curentPage;
                return;
            }
        }else if (action == 'last'){
            if (curentPage > 1){
                curentPage--;
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                return;
            }
        }else {
            mark = action;
        }
    }

    $.getJSON("/api.php?action=api_getTianDataList",{
        "mark":mark,
        "curentPage":curentPage
    },function(res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();

        var pinjie ='';
        curentPage > 1? pinjie=curentPage-1:'';

        var jsonStr = res;
        if (jsonStr.code == 0 && jsonStr.data.length != 0){

                //有数据,添加列表
                if (mark == 'daifankui'){
                    $(".datalist").append(
                        "<div style='height: 10%;background-color: #f2f7fe;'>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                        +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                        +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >主办单位</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                        +"</div>");
                }else if (mark == 'suoyou'){
                    $(".datalist").append(
                        "<div style='height: 10%;background-color: #f2f7fe;'>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                        +"<div style='width: 25%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案人</div>"
                        +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >办理进度</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                        +"</div>");
                }else {
                    $(".datalist").append(
                        "<div style='height: 10%;background-color: #f2f7fe;'>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                        +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                        +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提交时间</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >办理进度</div>"
                        +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                        +"</div>");
                }



            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {


                var type = '';

                switch (t.type){
                    case '1':
                        type = '经济类';
                        break;
                    case '2':
                        type = '文教体卫';
                        break;
                    case '3':
                        type = '政法统战政协';
                        break;
                }
                var progress = '';
                switch (t.state){
                    case '1':
                        progress = '待审查';
                        break;
                    case '2':
                        progress = '未立案';
                        break;
                    case '3':
                        progress = '待交办';
                        break;
                    case '4':
                        progress = '办理中';
                        break;
                    case '5':
                        progress = '待反馈';
                        break;
                    case '6':
                        progress = '办完结';
                        break;
                }
                var bianhao = '';
                if (mark == 'suoyou'){
                    //拼接列表
                    if (number % 2 == 0){
                        if (curentPage > 1){
                            (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                        }else {
                            bianhao = pinjie+(number+1);
                        }

                        $(".datalist").append(
                            "<div style='height: 9%;background-color: white;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                            +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );


                    }else {
                        if (curentPage > 1){
                            (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                        }else {
                            bianhao = pinjie+(number+1);
                        }

                        $(".datalist").append(
                            "<div style='height: 9%;background-color: #f7f7f7;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                            +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );
                    }

                }else {
                    //拼接列表
                    if (number % 2 == 0){
                        if (curentPage > 1){
                            (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                        }else {
                            bianhao = pinjie+(number+1);
                        }
                        $(".datalist").append(
                            "<div style='height: 9%;background-color: white;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                            +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );
                    }else {
                        if (curentPage > 1){
                            (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                        }else {
                            bianhao = pinjie+(number+1);
                        }
                        $(".datalist").append(
                            "<div style='height: 9%;background-color: #f7f7f7;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                            +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );
                    }
                }

            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");
            maxPage = Math.ceil(jsonStr.size/10);

            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $(".tableft").click(function () {
                getDataList('last');
            });
            $(".tabright").click(function () {
                getDataList('next');
            });

        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}


//针对所有
var checkedList = new Array();
var lastAllMark = '';
function getAllDataList(action,page,last){
    var curentPage;
    var mark;
    page.length == 0? curentPage = 1:curentPage = page;
    action.length == 0? mark = $(".mark").attr('id'):mark = action;
    last.length ==0? '':mark = last;

    $.getJSON("/api.php?action=api_getAllTianDataList",{
        "mark":mark,
        "curentPage":curentPage
    },function(res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();

        var pinjie ='';
        curentPage > 1? pinjie=curentPage-1:'';
        var jsonStr = res;
        if (jsonStr.code == 0 && jsonStr.data.length != 0){
            $(".datalist").append(
                "<div style='height: 10%;background-color: #f2f7fe;'>"
                +"<div style='width: 10%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >"
                +"<input class='allCheck' type='checkbox' style='position: relative;top: 2px;width: 20px;height: 20px;'>"
                +"<span >全选</span>"
                +"</div>"
                +"<div style='width: 6%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                +"<div style='width: 25%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案人</div>"
                +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                +"<div style='width: 10%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                +"<div style='width: 10%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >办理进度</div>"
                +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                +"</div>");
            var bianhao = '';
            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {
                var type = '';

                switch (t.type){
                    case '1':
                        type = '经济类';
                        break;
                    case '2':
                        type = '文教体卫';
                        break;
                    case '3':
                        type = '政法统战政协';
                        break;
                }

                var progress = '';
                switch (t.state){
                    case '1':
                        progress = '待审查';
                        break;
                    case '2':
                        progress = '未立案';
                        break;
                    case '3':
                        progress = '待交办';
                        break;
                    case '4':
                        progress = '办理中';
                        break;
                    case '5':
                        progress = '待反馈';
                        break;
                    case '6':
                        progress = '办完结';
                        break;
                }

                //拼接列表
                if (number % 2 == 0){
                    if (curentPage > 1){
                        (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                    }else {
                        bianhao = pinjie+(number+1);
                    }
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: white;'>"
                        +"<div  style='width: 10%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >"
                        +"<input class='download' id='"+ t.id +"' type='checkbox' style='position: relative;top: 43%;transform: translateY(-50%);width: 20px;height: 20px'>"
                        +"</div>"
                        +"<div style='width: 6%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                        +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 10%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 10%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><span style='color: #4e99ff; '>查看</span></a>"
                        +   "<div style='display: none;color: #4e99ff;'>&nbsp|</div>"
                        +"  <a href='?action="+$(".mark").attr('id')+"&downloadID="+t.id+"' style='display: none;position: relative;top: 50%;transform: translateY(-50%);'><span style='color: #4e99ff; '>下载</span></a>"
                        +"</div>"
                        +"</div>"
                    );
                }else {
                    if (curentPage > 1){
                        (number+1) % 10 == 0? bianhao=(curentPage)+'0':bianhao = pinjie+''+(number+1);
                    }else {
                        bianhao = pinjie+(number+1);
                    }
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: #f7f7f7;'>"
                        +"<div style='width: 10%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >"
                        +"<input class='download' id='"+ t.id +"' type='checkbox' style='position: relative;top: 43%;transform: translateY(-50%);width: 20px;height: 20px'>"
                        +"</div>"
                        +"<div style='width: 6%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+bianhao+"</div>"
                        +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 10%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 10%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><span style='color: #4e99ff; '>查看</span></a>"
                        +   "<div style='display: none;color: #4e99ff;'>&nbsp|</div>"
                        +"  <a href='?action="+$(".mark").attr('id')+"&downloadID="+t.id+"' style='display: none;position: relative;top: 50%;transform: translateY(-50%);'><span style='color: #4e99ff; '>下载</span></a>"
                        +"</div>"
                        +"</div>"
                    );
                }
            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");
            maxPage = jsonStr.size;
            lastAllMark = mark;
            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){

                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $('.datalist_item').each(function (n) {
                $(this).click(function () {
                    getAllDataList('',(n+1),lastAllMark);
                });
            });

            $(".tableft").click(function (){
                if (curentPage > 1){
                    curentPage--;
                    getAllDataList('',curentPage,lastAllMark);
                }else {
                    return;
                }
            });

            $(".tabright").click(function () {
                if (maxPage > 10) var size = Math.ceil(maxPage/10);
                if(curentPage+1 <= size){
                    curentPage++;
                    getAllDataList('',curentPage,lastAllMark);
                }else {
                    return;
                }
            });
            var isAllCheck = true;
            $('.download').each(function (){
                $.inArray($(this).attr('id'),checkedList) == -1? $(this).prop('checked',false):$(this).prop('checked',true);
            });

            $('.download').each(function (){
                if (!$(this).prop('checked')){
                    $('.allCheck').prop('checked',false);
                    isAllCheck = false;
                }
            });

            if (isAllCheck){
                $('.allCheck').prop('checked',true);
            }


            $(".allCheck").click(function (){
                if($(this).prop('checked')){
                    $(".download").each(function (n) {
                        $(this).prop('checked',true);
                        $.inArray($(this).attr('id'),checkedList) == -1? checkedList.push($(this).attr('id')):'';
                    });
                }else {
                    $(".download").each(function (n) {
                        $(this).prop('checked',false);
                        $.inArray($(this).attr('id'),checkedList) != -1? checkedList.splice($.inArray($(this).attr('id'),checkedList),1):'';
                    });
                }
                console.log(checkedList);
                $('.shumu').html(checkedList.length);

                checkedList.length != 0? $('.downloadprompt').css('display','block'):$('.downloadprompt').css('display','none');
            });

            $(".download").each(function (){
                $(this).click(function (){

                    //2.检查全选是否勾选
                    var isAllchecked = true;
                    $('.download').each(function (){
                        if (!$(this).prop('checked')){
                            $('.allCheck').prop('checked',false);
                            isAllchecked = false;
                        }
                    });

                    if (isAllchecked){
                        $('.allCheck').prop('checked',true);
                    }

                    //3.检查list中是否添加id
                    if ($(this).prop('checked')){
                        $.inArray($(this).attr('id'),checkedList) == -1? checkedList.push($(this).attr('id')):'';
                    }else {
                        $.inArray($(this).attr('id'),checkedList) != -1? checkedList.splice($.inArray($(this).attr('id'),checkedList),1):'';
                    }

                    $('.shumu').html(checkedList.length);
                    checkedList.length != 0? $('.downloadprompt').css('display','block'):$('.downloadprompt').css('display','none');
                });
            });

        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}


function resetMessage(action) {
    switch (action){
        case 5:
            $('.anyou_search').val('');
            $('.keyword_search').val('');
            break;
        default:
            $('.anyou_search').val('');
            break;
    }
}



//清除关键字
function clearKeyword() {
    $('.my_search_keyword').val('');
}
//查询我的提案
function searchMyproposal(action) {
    var curentPage = $('.datalist').attr('id');
    var mark = '';
    var keyword = $('.my_search_keyword').val();
    if (action.length == 0){
        mark = $(".mark").attr('id');
    }else {
        if (action == 'next'){
            if(++curentPage <= maxPage){
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                --curentPage;
                return;
            }
        }else if (action == 'last'){
            if (curentPage > 1){
                curentPage--;
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                return;
            }
        }else {
            mark = action;
        }
    }

    $.getJSON("/api.php?action=api_searchMyProposal",{
        "keyword":keyword,
        "curentPage":curentPage
    },function(res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();

        var jsonStr = res;
        if (jsonStr.code == 0 && jsonStr.data.length != 0){


            //有数据,添加列表
            if (mark == 'daifankui'){
                $(".datalist").append(
                    "<div style='height: 10%;background-color: #f2f7fe;'>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                    +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                    +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >主办单位</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                    +"</div>");
            }else {
                $(".datalist").append(
                    "<div style='height: 10%;background-color: #f2f7fe;'>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                    +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                    +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提交时间</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >办理进度</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                    +"</div>");
            }


            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {
                var type = '';
                switch (t.type){
                    case '1':
                        type = '经济类';
                        break;
                    case '2':
                        type = '文教体卫';
                        break;
                    case '3':
                        type = '政法统战政协';
                        break;
                }

                var progress = '';
                switch (t.state){
                    case '1':
                        progress = '待审查';
                        break;
                    case '2':
                        progress = '未立案';
                        break;
                    case '3':
                        progress = '待交办';
                        break;
                    case '4':
                        progress = '办理中';
                        break;
                    case '5':
                        progress = '待反馈';
                        break;
                    case '6':
                        progress = '办完结';
                        break;
                }

                var pinjie ='';
                curentPage > 1? pinjie=curentPage-1:'';
                //拼接列表
                if (number % 2 == 0){
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: white;'>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }else {
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: #f7f7f7;'>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }
            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");

            maxPage = Math.ceil(jsonStr.size/10);
            lastMark = mark;
            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $(".tableft").click(function () {
                searchMyproposal('last');
            });
            $(".tabright").click(function () {
                searchMyproposal('next');
            });

        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}


function searchProposalToMark(action){
    var curentPage = $('.datalist').attr('id');
    var mark = $('.mark').attr('id');
    var anyou_search = $('.anyou_search').val();
    switch (action){
        case 'next':
            if(curentPage+1 <= searhMaxPage){
                curentPage++;
                $('.datalist').attr('id',curentPage);
                searchProposalToMark('');
            }else {
                return;
            }
            break;
        case 'last':
            if (curentPage > 1){
                curentPage--;
                $('.datalist').attr('id',curentPage);
                searchProposalToMark('');
            }else {
                return;
            }
            break;
    }
    $.getJSON('api.php?action=api_searchProposalToanyou',{'mark':mark,'anyou_search':anyou_search,'curentPage':curentPage},function (res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();
        var jsonStr = res;

        if (jsonStr.code == 0 && jsonStr.data.length != 0){

            //有数据,添加列表
            if (mark == 'daifankui'){
                $(".datalist").append(
                    "<div style='height: 10%;background-color: #f2f7fe;'>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                    +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                    +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >主办单位</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                    +"</div>");
            }else if (mark == 'suoyou'){
                $(".datalist").append(
                    "<div style='height: 10%;background-color: #f2f7fe;'>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                    +"<div style='width: 25%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案人</div>"
                    +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >主办单位</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                    +"</div>");
            }else {
                $(".datalist").append(
                    "<div style='height: 10%;background-color: #f2f7fe;'>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                    +"<div style='width: 37%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                    +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提交时间</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >办理进度</div>"
                    +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                    +"</div>");
            }

            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {
                var type = '';

                switch (t.type){
                    case '1':
                        type = '经济类';
                        break;
                    case '2':
                        type = '文教体卫';
                        break;
                    case '3':
                        type = '政法统战政协';
                        break;
                }

                var progress = '';
                switch (t.state){
                    case '1':
                        progress = '待审查';
                        break;
                    case '2':
                        progress = '未立案';
                        break;
                    case '3':
                        progress = '待交办';
                        break;
                    case '4':
                        progress = '办理中';
                        break;
                    case '5':
                        progress = '待反馈';
                        break;
                    case '6':
                        progress = '办完结';
                        break;
                }
                var pinjie ='';
                curentPage > 1? pinjie=curentPage-1:'';
                if (mark == 'suoyou'){
                    //拼接列表
                    if (number % 2 == 0){
                        $(".datalist").append(
                            "<div style='height: 9%;background-color: white;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                            +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );
                    }else {
                        $(".datalist").append(
                            "<div style='height: 9%;background-color: #f7f7f7;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                            +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );
                    }

                }else {
                    //拼接列表
                    if (number % 2 == 0){
                        $(".datalist").append(
                            "<div style='height: 9%;background-color: white;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                            +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );
                    }else {
                        $(".datalist").append(
                            "<div style='height: 9%;background-color: #f7f7f7;'>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                            +"<div style='overflow: hidden;width: 37%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                            +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                            +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                            +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                            +"</div>"
                            +"</div>"
                        );
                    }
                }

            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");
            maxPage = Math.ceil(jsonStr.size/10);

            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $(".tableft").click(function () {
                searchProposalToMark('last');
            });
            $(".tabright").click(function () {
                searchProposalToMark('next');
            });

        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}

var searhMaxPage = 0;
function searchProposal(action){
    var curentPage = $('.datalist').attr('id');
    var mark = $('.mark').attr('id');
    var anyou_search = $('.anyou_search').val();
    var keyword_search = $('.keyword_search').val();
    switch (action){
        case 'next':
            if(curentPage+1 <= searhMaxPage){
                curentPage++;
                $('.datalist').attr('id',curentPage);
                searchProposal('');
            }else {
                return;
            }
            break;
        case 'last':
            if (curentPage > 1){
                curentPage--;
                $('.datalist').attr('id',curentPage);
                searchProposal('');
            }else {
                return;
            }
            break;
    }

    $.getJSON('api.php?action=api_searchProposal',{'keyword_search':keyword_search,'anyou_search':anyou_search,'curentPage':curentPage},function (res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();

        var jsonStr = res;
        if (jsonStr.code == 0 && jsonStr.data.length != 0){
            //有数据,添加列表
            $(".datalist").append(
                "<div style='height: 10%;background-color: #f2f7fe;'>"
                +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >编号</div>"
                +"<div style='width: 25%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >案由</div>"
                +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案人</div>"
                +"<div style='width: 15%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >答复时间</div>"
                +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >提案类型</div>"
                +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >主办单位</div>"
                +"<div style='width: 12%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                +"</div>");

            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {
                var type = '';

                switch (t.type){
                    case '1':
                        type = '经济类';
                        break;
                    case '2':
                        type = '文教体卫';
                        break;
                    case '3':
                        type = '政法统战政协';
                        break;
                }

                var progress = '';
                switch (t.state){
                    case '1':
                        progress = '待审查';
                        break;
                    case '2':
                        progress = '未立案';
                        break;
                    case '3':
                        progress = '待交办';
                        break;
                    case '4':
                        progress = '办理中';
                        break;
                    case '5':
                        progress = '待反馈';
                        break;
                    case '6':
                        progress = '办完结';
                        break;
                }
                var pinjie ='';
                curentPage > 1? pinjie=curentPage-1:'';
                //拼接列表
                if (number % 2 == 0){
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: white;'>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }else {
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: #f7f7f7;'>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='overflow: hidden;width: 25%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.anyou+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 15%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.committime+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+type+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+progress+"</div>"
                        +"<div style='width: 12%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&proposalID="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }
            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");
            searhMaxPage = Math.ceil(jsonStr.size/10);

            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $(".tableft").click(function () {
                searchProposal('last');
            });
            $(".tabright").click(function () {
                searchProposal('next');
            });
        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}



//获取委员信息列表数据
function getweiyuanList(action){
    var curentPage = $('.datalist').attr('id');
    var mark = $(".mark").attr('id');
    switch (action){
        case 'next':
            if(curentPage+1 <= maxPage){
                curentPage++;
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                return;
            }
            break;
        case 'last':
            if (curentPage > 1){
                curentPage--;
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                return;
            }
            break;
    }


    $.getJSON("/api.php?action=api_getweiyuanList",{
        "curentPage":curentPage,
        "jieci":action
    },function(res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();


        var jsonStr = res;
        if (jsonStr.code == 0 && jsonStr.data.length != 0){

            //有数据,添加列表

            $(".datalist").append(
                "<div style='height: 10%;background-color: #f2f7fe;'>"
                +"<div style='width: 8%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >序号</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >届次</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >姓名</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >性别</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >年龄</div>"
                +"<div style='width: 14%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >党派群体</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >工作单位</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >联系方式</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                +"</div>");
            var pinjie ='';
            curentPage > 1? pinjie=curentPage-1:'';
            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {
                //拼接列表
                if (number % 2 == 0){
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: white;'>"
                        +"<div style='width: 8%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >20"+t.session+"届</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.sex+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.age+"</div>"
                        +"<div style='width: 14%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.party+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.work+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.phone+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&id="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }else {
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: #f7f7f7;'>"
                        +"<div style='width: 8%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >20"+t.session+"届</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.sex+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.age+"</div>"
                        +"<div style='width: 14%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.party+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.work+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.phone+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&id="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }
            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");
            maxPage = Math.ceil(jsonStr.size/10);

            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $(".tableft").click(function () {
                getweiyuanList('last');
            });
            $(".tabright").click(function () {
                getweiyuanList('next');
            });

        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}

function serachWeiyuan(action){
    var curentPage = $('.datalist').attr('id');
    var weiyuan_keyword = $('.weiyuan_keyword').val();
    var mark = $(".mark").attr('id');
    switch (action){
        case 'next':
            if(curentPage+1 <= maxPage){
                curentPage++;
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                return;
            }
            break;
        case 'last':
            if (curentPage > 1){
                curentPage--;
                window.location.href = '?action='+$(".mark").attr('id')+'&page='+curentPage;
            }else {
                return;
            }
            break;
    }

    $.getJSON("/api.php?action=api_searchWeiyuan",{
        "curentPage":curentPage,
        "keyword":weiyuan_keyword
    },function(res) {
        //清空
        $(".datalist").css('background-image','');
        $(".datalist").empty();
        $(".listtab").empty();


        var jsonStr = res;
        if (jsonStr.code == 0 && jsonStr.data.length != 0){

            //有数据,添加列表
            $(".datalist").append(
                "<div style='height: 10%;background-color: #f2f7fe;'>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >序号</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >届次</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >姓名</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >性别</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >年龄</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >党派群体</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >工作单位</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >联系方式</div>"
                +"<div style='width: 11%;float: left;color: #429de3;font-size: 16px;height:100%;line-height: 70px;text-align: center;' >操作</div>"
                +"</div>");
            var pinjie ='';
            curentPage > 1? pinjie=curentPage-1:'';
            //拼接获取到的数据
            jsonStr.data.forEach(function (t, number, ts) {
                //拼接列表
                if (number % 2 == 0){
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: white;'>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >20"+t.session+"届</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.sex+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.age+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.party+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.work+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.phone+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&id="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }else {
                    $(".datalist").append(
                        "<div style='height: 9%;background-color: #f7f7f7;'>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+pinjie+(number+1)+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >20"+t.session+"届</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.realname+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.sex+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.age+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.party+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.work+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"+t.phone+"</div>"
                        +"<div style='width: 11%;height: 100%;float: left;color: #333;font-size: 14px;line-height: 63px;text-align: center;' >"
                        +"  <a href='?action="+$(".mark").attr('id')+"&id="+t.id+"' style='width: 80px;height: 30px;display: inline-block;position: relative;top: 50%;transform: translateY(-50%);'><div style='line-height: 30px;background-color: #4e99ff;color: white;text-align:center;width: 80px;height: 30px;border-radius: 4px'>查看</div></a>"
                        +"</div>"
                        +"</div>"
                    );
                }
            });

            $(".tableft").css("visibility","inherit");
            $(".tabright").css("visibility","inherit");
            maxPage = Math.ceil(jsonStr.size/10);

            //拼接页签
            if (jsonStr.size > 10){
                var size = Math.ceil(jsonStr.size/10);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".listtab").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".listtab").append("<a href='?action="+$(".mark").attr('id')+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".listtab").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }

            $(".tableft").click(function () {
                serachWeiyuan('last');
            });
            $(".tabright").click(function () {
                serachWeiyuan('next');
            });

        }else {
            //无数据,添加图片
            $(".datalist").css('background-image','url(/images/wode/nodata.png)');
            $(".datalist").css('background-repeat','no-repeat');
            $(".datalist").css('background-position','center');
        }
    });
}

function clearWeiyuan() {
    $('.weiyuan_keyword').val('');
}


//答复提案
function response(){
    //操作人id
    var id = $('.userid_flag').attr('id');
    //提案id
    var proposalNum = $('.proposalNum').attr('id');
    //答复内容
    var dafucontent = $('.dafucontent').val();
    //附件
    //验证文件上传
    var path = $('.mobileupload')[0].files;
    if (path.length != 0){
        //有文件
        var formData = new FormData();
        var names = '';
        for(var i= 0,name;i<path.length;i++){
            name = path[i].name.split('.')[0];
            formData.append(name, path[i]);
            names += name + ',';
        }
        formData.append('info',names);

        $.ajax({
            url: '/api.php?action=api_uploadFile',
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
            dataType: 'json',
            //发送前调用
            beforeSend: function(){
                $('.banli_error_dialog').css('visibility','visible');
            },
            //成功
            success: function(result)
            {
                //$('.dialog_progress').html(result);
                //json解析
                if (result.code == 1){
                    $('.banli_error_dialog').html('上传失败!');
                }else {
                    //获取文件信息
                    var data = result.data;
                    var file_id = '';
                    for (var i=0;i<data.length;i++){
                        if (i == 0){
                            file_id += data[i].id;
                        }else {
                            file_id += (',' + data[i].id);
                        }
                    }
                    $.getJSON('/api.php?action=api_response',{
                        'userId':id,
                        'proposalId':proposalNum,
                        'dafu':dafucontent,
                        'fileId':file_id
                    },function(res) {
                        if (res.code == 0){
                            data = res.data;
                            //弹出dialog
                            $('.reuse_dialog').show();
                            $('.commitDialog').hide();
                            var text = '《' + data.proposalName + '》提案,于'+ data.operatetime + '答复成功';
                            $('.successMessage').html(text);
                            //&proposalID='+data.proposalid
                            $('.fanhui').click(function (){window.location.href = '?action=banli'});
                            $('.successDialog').show();
                        }else {
                            alert(res.msg);
                        }
                    });
                }
            },
            //失败
            error: function (result) {
                $('.banli_error_dialog').html('上传错误!');
            },
            //进度
            xhr: function(){
                var xhr = $.ajaxSettings.xhr();
                if(onprogress && xhr.upload) {
                    xhr.upload.addEventListener('progress' , onprogress, false);
                    return xhr;
                }
            }
        });

        //输出进度
        function onprogress(evt) {
            var loaded = evt.loaded;
            var tot = evt.total;
            $('.banli_error_dialog').html("正在上传:"+(Math.floor(100 * loaded / tot) + '%'));
        }

    }else {
        //无文件
        //hidden
        alert('必须要上传资料文件!');
    }
}

//创建用户组
function createUserGrounp(){
    var map = new Object();
    var id = $('.main_tilte_right_avtar').attr('id');
    map['role'] = $('.role').val();
    map['description'] = $('.description').val();

    if (map['role'].length == 0 || map['description'].length == 0){
        alert("角色和描述必须填写!");
        return;
    }

    var mypermissions = new Array("homepage","myproposal","createproposal","daifankuiproposal","shenchaproposal","jiaobanproposal","banliproposal","yibanproposal","suoyouproposal","weiyuaninfo","message","manager");
    $('.check').each(function (n) {
        if ($(this).css("display") == 'none'){
            map[mypermissions[n]] = 0;
        }else {
            map[mypermissions[n]] = 1;
        }
    });

    var json = JSON.stringify(map);
    $.getJSON("/api.php?action=api_createUserGroup",{"json":json,"userid":id},function (res) {
       if (res.code == 0){
           //成功
           alert(res.msg);
           window.location.href = '?action=xitong';
       }else {
           //失败
           alert(res.msg);
       }
    });
}

//更新用户组
function updateUserGroup() {
    var map = new Object();
    var id = $('.main_tilte_right_avtar').attr('id');
    var groupid = $('.groupid_flag').attr('id');

    map['role'] = $('.role').val();
    map['description'] = $('.description').val();


    if (map['role'].length == 0 || map['description'].length == 0){
        alert("角色和描述必须填写!");
        return;
    }

    var mypermissions = new Array("homepage","myproposal","createproposal","daifankuiproposal","shenchaproposal","jiaobanproposal","banliproposal","yibanproposal","suoyouproposal","weiyuaninfo","message","manager");
    $('.check').each(function (n) {
        if ($(this).css("display") == 'none'){
            map[mypermissions[n]] = 0;
        }else {
            map[mypermissions[n]] = 1;
        }
    });

    var json = JSON.stringify(map);
    $.getJSON("/api.php?action=api_updateUserGroup",{"json":json,"userid":id,"groupid":groupid},function (res) {
        if (res.code == 0){
            //成功
            alert(res.msg);
            dissmissdialog();
            window.location.href = '?action=xitong';
        }else {
            //失败
            alert(res.msg);
        }
    });
}

//创建用户
function createUser() {
    var map = new Object();
    var id = $('.main_tilte_right_avtar').attr('id');
    var dengluming = $(".dengluming").val();//登录名
    var denglumima = $(".denglumima").val();//登录密码
    var shifouqiyong = 0; //是否启用 1为启用  2为不启用
    $(".check1").css('display') == 'none' ? shifouqiyong=2 : shifouqiyong = 1;
    var xingming = $(".xingming").val();//姓名
    var nianling = $(".nianling").val();//年龄
    var gongzuodanwei = $(".gongzuodanwei").val();//工作单位
    var phone = $(".phone").val();//手机号码
    var jiedaogongwei = $(".jiedaogongwei").val();//街道工委
    var suoshujuese = $(".select_juese").text();//所属角色 //请选择为空
    var xingbie = $(".select_sex").text();//性别 //请选择为空
    var jieci = $(".select_jieci").text();//届次 //请选择为空
    var dangpai = $(".select_party").text();//党派 //请选择为空

    if(suoshujuese == '请选择' ||
        xingbie == '请选择' ||
        jieci == '请选择' ||
        dangpai == '请选择' ||
        id.length == 0 ||
        dengluming.length == 0 ||
        denglumima.length == 0 ||
        xingming.length == 0 ||
        nianling.length == 0 ||
        gongzuodanwei.length == 0 ||
        phone.length == 0 ||
        jiedaogongwei.length == 0){
        alert("所有参数都必须填写!");
        return;
    }
    



    map['id'] = id;
    map['dengluming'] = dengluming;
    map['denglumima'] = denglumima;
    map['shifouqiyong'] = shifouqiyong;
    map['xingming'] = xingming;
    map['nianling'] = nianling;
    map['gongzuodanwei'] = gongzuodanwei;
    map['phone'] = phone;
    map['jiedaogongwei'] = jiedaogongwei;
    map['suoshujuese'] = suoshujuese;
    map['xingbie'] = xingbie;
    map['jieci'] = jieci;
    map['dangpai'] = dangpai;


    var json = JSON.stringify(map);
    $.getJSON("/api.php?action=api_createUser",{"json":json},function (res) {
        if (res.code == 0){
            alert(res.msg);
            window.location.href = '?action=xitong&manager=2';
        }else {
            alert(res.msg);
        }
    });
}

//更新用户信息
function updateUser(){
    var map = new Object();
    var dengluming = $(".dengluming").val();//登录名
    var denglumima = $(".denglumima").val();//登录密码
    var shifouqiyong = 0; //是否启用 1为启用  2为不启用
    $(".check1").css('display') == 'none' ? shifouqiyong=2 : shifouqiyong = 1;
    var xingming = $(".xingming").val();//姓名
    var nianling = $(".nianling").val();//年龄
    var gongzuodanwei = $(".gongzuodanwei").val();//工作单位
    var phone = $(".phone").val();//手机号码
    var jiedaogongwei = $(".jiedaogongwei").val();//街道工委
    var suoshujuese = $(".select_juese").text();//所属角色 //请选择为空
    var xingbie = $(".select_sex").text();//性别 //请选择为空
    var jieci = $(".select_jieci").text();//届次 //请选择为空
    var dangpai = $(".select_party").text();//党派 //请选择为空
    var id = $(".id_flag").attr('id');

    if(suoshujuese == '请选择' ||
        suoshujuese == '' ||
        xingbie == '请选择' ||
        xingbie == '' ||
        jieci == '请选择' ||
        jieci == '' ||
        dangpai == '请选择' ||
        dangpai == '' ||
        id.length == 0 ||
        dengluming.length == 0 ||
        denglumima.length == 0 ||
        xingming.length == 0 ||
        nianling.length == 0 ||
        gongzuodanwei.length == 0 ||
        phone.length == 0 ||
        jiedaogongwei.length == 0){
        alert("所有参数都必须填写!");
        return;
    }



    map['id'] = id;
    map['dengluming'] = dengluming;
    map['denglumima'] = denglumima;
    map['shifouqiyong'] = shifouqiyong;
    map['xingming'] = xingming;
    map['nianling'] = nianling;
    map['gongzuodanwei'] = gongzuodanwei;
    map['phone'] = phone;
    map['jiedaogongwei'] = jiedaogongwei;
    map['suoshujuese'] = suoshujuese;
    map['xingbie'] = xingbie;
    map['jieci'] = jieci;
    map['dangpai'] = dangpai;

    var json = JSON.stringify(map);
    $.getJSON("/api.php?action=api_updateUser",{"json":json},function (res) {
        if (res.code == 0){
            alert(res.msg);
            window.location.href = '?action=xitong&manager=2';
        }else {
            alert(res.msg);
        }
    });
}



var announcementSize = 0;
var taskSize = 0;
var chatSize = 0;
var groupSize = 0;
var all = 0;
//获取总数
function getTaskCount(){
    $.getJSON('/api.php?action=api_getTaskCount',{},function (res) {
        if (res.code == 0){
            //获取条目
            announcementSize = res.size.announcementSize;
            taskSize = res.size.taskSize;
            chatSize = res.size.chatSize;
            groupSize = res.size.groupSize;
            all = res.size.all;

            if (announcementSize != 0){
                $(".allAnnouncement").css('display','block');
                $(".allAnnouncement").html(res.size.announcementSize);
            }

            if (taskSize != 0){
                $(".allTask").css('display','block');
                $(".allTask").html(res.size.taskSize);
            }

            if (chatSize != 0){
                $(".allChat").css('display','block');
                $(".allChat").html(res.size.chatSize);
            }

            if (groupSize != 0){
                $(".allGroup").css('display','block');
                $(".allGroup").html(res.size.groupSize);
            }

            if (all != 0){
                $(".allMessage").css('display','block');
                $(".allMessage").html(res.size.all);
            }
            checkTaskCount();
        }
    });
}

function checkTaskCount(){
    var mod = $('.list').attr('id');
    $.getJSON('/api.php?action=api_getTaskCount',{},function (res) {
        if (res.code == 0){
            //获取条目
            if (announcementSize < res.size.announcementSize){
                $(".allAnnouncement").html(res.size.announcementSize);
                getTaskList(mod);
            }

            if (taskSize < res.size.taskSize){
                $(".taskSize").html(res.size.taskSize);
                getTaskList(mod);
            }

            if (chatSize < res.size.chatSize){
                $(".chatSize").html(res.size.chatSize);
                getTaskList(mod);
            }

            if (groupSize < res.size.groupSize){
                $(".groupSize").html(res.size.groupSize);
                getTaskList(mod);
            }

            if (all < res.size.all){
                $(".all").html(res.size.all);
                getTaskList(mod);
            }
            /*announcementSize < res.size.announcementSize ? $(".allAnnouncement").html(res.size.announcementSize) :'';
            taskSize < res.size.taskSize ? $(".allTask").html(res.size.taskSize):'';
            chatSize < res.size.chatSize ? $(".allChat").html(res.size.chatSize):'';
            groupSize < res.size.groupSize ? $(".allGroup").html(res.size.groupSize):'';
            all < res.size.all? $(".allMessage").html(res.size.all):'';*/
            setTimeout(function() {checkTaskCount();},1000);
        }
    });
}

function getNavNum(){
    $.getJSON('/api.php?action=api_getNavNum',{},function (res) {
        if (res.code == 0){

            if (res.data.shenchaSize != 0){
                $(".remind_shencha").css('display','block');
                $(".remind_shencha").html(res.data.shenchaSize);
            }else {
                $(".remind_shencha").css('display','none');
            }

            if (res.data.jiaobanSize != 0){
                $(".remind_jiaoban").css('display','block');
                $(".remind_jiaoban").html(res.data.jiaobanSize);
            }else {
                $(".remind_jiaoban").css('display','none');
            }

            if (res.data.banliSize != 0){
                $(".remind_banli").css('display','block');
                $(".remind_banli").html(res.data.banliSize);
            }else {
                $(".remind_banli").css('display','none');
            }

            if (res.data.fankuiSize != 0){
                $(".remind_daifankui").css('display','block');
                $(".remind_daifankui").html(res.data.fankuiSize);
            }else {
                $(".remind_daifankui").css('display','none');
            }

            if (res.data.messageCenter != 0){
                $(".remind_xinxi").css('display','block');
                $(".remind_xinxi").html(res.data.messageCenter);
            }else {
                $(".remind_xinxi").css('display','none');
            }

            setTimeout(function() {getNavNum();},1000);
        }
    });
}


//任务列表
//1为公告  2为任务  3为私聊  4为群聊
var messageMaxPage = 0;
function getTaskList(action){
    var curentPage = Number($('.tablist').attr('id'));
    var mark = $('.action_flag').attr('id')
    var mod = $('.list').attr('id');
    var max = 0;

    if (action.length == 0){
        action = 1;
    }else {
        switch (action){
            case 'next':
                messageMaxPage > 7 ?  max=Math.ceil(messageMaxPage/7):max = 1;
                if(curentPage+1 <= max){
                    curentPage++;
                    window.location.href = '?action='+ mark +'&mod='+mod+'&page='+curentPage;
                }else {
                    return;
                }
                break;
            case 'last':
                if (curentPage > 1){
                    curentPage--;
                    window.location.href = '?action='+ mark +'&mod='+mod+'&page='+curentPage;
                }else {
                    return;
                }
                break;
        }
    }



    $.getJSON('/api.php?action=api_getTaskList',{'curentPage':curentPage,'mod':mod},function (res) {
        if (res.code == 0){
            messageMaxPage = res.size;
            $('.list').empty();
            $('.tablist').empty();


            var ismod = '';
            var isurl = '';
            switch (action){
                case '1':
                    res.data.forEach(function (t, number, ts) {
                        var name = '';
                        var url = '';
                        //清空
                        switch (t.taskType){
                            case '1':
                                var islook = '未读';
                                console.log('第'+number+'个查看状态为->>>'+t.isLook);
                                if (t.isLook == 1) islook = '已查看'+t.lookNum+'次';
                                name = "【公告】";
                                url = "/images/message/gonggao.png";
                                break;
                            case '2':
                                var islook = '已读';
                                if (t.isLook == 2) islook = '未读';
                                name = "【任务】";
                                url = "/images/message/renwu.png";
                                break;
                            case '3':
                                var islook = '已读';
                                if (t.isLook == 2) islook = '未读';
                                name = "【私聊】";
                                url = "/images/message/siliao.png";
                                break;
                            case '4':
                                var islook = '已读';
                                if (t.isLook == 2) islook = '未读';
                                name = "【群组】";
                                url = "/images/message/qunzu.png";
                                break;
                        }

                        $('.list').append(
                            "<div style='width: 100%;height: 110px;border-bottom: 1px solid #eaf3ff'>" +
                            "<div style='width: 20%;height: 100%;float: left;line-height: 110px'>" +
                            "<div style='margin: 0 auto;width: 150px;font-size: 18px;height: 110px;text-indent: 60px;background: url("+url+") no-repeat left'>"+name+"</div>" +
                            "</div>" +
                            "<div style='width: 60%;height: 100%;float: left'>" +
                            "<div style='height: 70px;width: 100%;position: relative;top: 50%;transform:translateY(-50%)'>" +
                            "<div style='height: 35px;width: 100%;line-height: 40px;color: #4e99ff;font-size: 16px;'>"+t.tasktime+"</div>" +
                            "<div style='height: 35px;width: 100%;line-height: 40px;color: #444444;font-size: 16px;'>"+t.taskcontent+"</div>" +
                            "</div>" +
                            "</div>" +
                            "<div style='width: 20%;height: 100%;float: left'>" +
                            "<a href='?action="+t.action+"&proposalID="+t.proposalId+"&taskid="+t.id+"&lock=1'><div style='margin-right:30px;position: relative;top: 50%;transform: translateY(-50%);width: 80px;height: 35px;float: right;line-height: 35px;font-size: 16px;color: white;background-color: #4e99ff;text-align: center;border-radius: 4px'>查看</div></a>" +
                            "<div style='font-size: 13px;position: relative; top: 50%;transform: translateY(-50%);height: 35px;line-height: 35px;color: #f48668;float: right;margin-right: 25px'>"+islook +"</div>" +
                            "</div>" +
                            "</div>"
                        );
                    });
                    break;
                case '2':
                    res.data.forEach(function (t, number, ts) {
                        //清空
                        switch (t.taskType){
                            case '1':
                                var islook = '未读';
                                if (t.isLook == 1) islook = '已查看'+t.lookNum+'次';
                                $('.list').append(
                                    "<div style='width: 100%;height: 110px;border-bottom: 1px solid #eaf3ff'>" +
                                    "<div style='width: 20%;height: 100%;float: left;line-height: 110px'>" +
                                    "<div style='margin: 0 auto;width: 150px;font-size: 18px;height: 110px;text-indent: 60px;background: url(/images/message/gonggao.png) no-repeat left'>【公告】</div>" +
                                    "</div>" +
                                    "<div style='width: 60%;height: 100%;float: left'>" +
                                    "<div style='height: 70px;width: 100%;position: relative;top: 50%;transform:translateY(-50%)'>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #4e99ff;font-size: 16px;'>"+t.tasktime+"</div>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #444444;font-size: 16px;'>"+t.taskcontent+"</div>" +
                                    "</div>" +
                                    "</div>" +
                                    "<div style='width: 20%;height: 100%;float: left'>" +
                                    "<a href='?action="+t.action+"&proposalID="+t.proposalId+"&taskid="+t.id+"&lock=1'><div style='margin-right:30px;position: relative;top: 50%;transform: translateY(-50%);width: 80px;height: 35px;float: right;line-height: 35px;font-size: 16px;color: white;background-color: #4e99ff;text-align: center;border-radius: 4px'>查看</div></a>" +
                                    "<div style='font-size: 13px;position: relative; top: 50%;transform: translateY(-50%);height: 35px;line-height: 35px;color: #f48668;float: right;margin-right: 25px'>"+islook +"</div>" +
                                    "</div>" +
                                    "</div>"
                                );
                                break;
                        }
                    });
                    break;
                case '3':
                    res.data.forEach(function (t, number, ts) {
                        //清空
                        switch (t.taskType){
                            case '2':
                                var islook = '已读';
                                if (t.isLook == 2) islook = '未读';
                                $('.list').append(
                                    "<div style='width: 100%;height: 110px;border-bottom: 1px solid #eaf3ff'>" +
                                    "<div style='width: 20%;height: 100%;float: left;line-height: 110px'>" +
                                    "<div style='margin: 0 auto;width: 150px;font-size: 18px;height: 110px;text-indent: 60px;background: url(/images/message/renwu.png) no-repeat left'>【任务】</div>" +
                                    "</div>" +
                                    "<div style='width: 60%;height: 100%;float: left'>" +
                                    "<div style='height: 70px;width: 100%;position: relative;top: 50%;transform:translateY(-50%)'>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #4e99ff;font-size: 16px;'>"+t.tasktime+"</div>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #444444;font-size: 16px;'>"+t.taskcontent+"</div>" +
                                    "</div>" +
                                    "</div>" +
                                    "<div style='width: 20%;height: 100%;float: left'>" +
                                    "<a href='?action="+t.action+"&proposalID="+t.proposalId+"&taskid="+t.id+"&lock=1'><div style='margin-right:30px;position: relative;top: 50%;transform: translateY(-50%);width: 80px;height: 35px;float: right;line-height: 35px;font-size: 16px;color: white;background-color: #4e99ff;text-align: center;border-radius: 4px'>查看</div></a>" +
                                    "<div style='font-size: 13px;position: relative; top: 50%;transform: translateY(-50%);height: 35px;line-height: 35px;color: #f48668;float: right;margin-right: 25px'>"+islook +"</div>" +
                                    "</div>" +
                                    "</div>"
                                );
                                break;
                        }
                    });
                    break;
                case '4':
                    res.data.forEach(function (t, number, ts) {
                        //清空
                        switch (t.taskType){
                            case '3':
                                var islook = '已读';
                                if (t.isLook == 2) islook = '未读';
                                $('.list').append(
                                    "<div style='width: 100%;height: 110px;border-bottom: 1px solid #eaf3ff'>" +
                                    "<div style='width: 20%;height: 100%;float: left;line-height: 110px'>" +
                                    "<div style='margin: 0 auto;width: 150px;font-size: 18px;height: 110px;text-indent: 60px;background: url(/images/message/siliao.png) no-repeat left'>【私聊】</div>" +
                                    "</div>" +
                                    "<div style='width: 60%;height: 100%;float: left'>" +
                                    "<div style='height: 70px;width: 100%;position: relative;top: 50%;transform:translateY(-50%)'>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #4e99ff;font-size: 16px;'>"+t.tasktime+"</div>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #444444;font-size: 16px;'>"+t.taskcontent+"</div>" +
                                    "</div>" +
                                    "</div>" +
                                    "<div style='width: 20%;height: 100%;float: left'>" +
                                    "<a href='?action="+t.action+"&proposalID="+t.proposalId+"&taskid="+t.id+"&lock=1'><div style='margin-right:30px;position: relative;top: 50%;transform: translateY(-50%);width: 80px;height: 35px;float: right;line-height: 35px;font-size: 16px;color: white;background-color: #4e99ff;text-align: center;border-radius: 4px'>查看</div></a>" +
                                    "<div style='font-size: 10px;position: relative; top: 50%;transform: translateY(-50%);font-size: 16px;height: 35px;line-height: 35px;color: #f48668;float: right;margin-right: 65px'>"+islook +"</div>" +
                                    "</div>" +
                                    "</div>"
                                );
                                break;
                        }
                    });
                    break;
                case '5':
                    res.data.forEach(function (t, number, ts) {
                        //清空
                        switch (t.taskType){
                            case '4':
                                var islook = '已读';
                                if (t.isLook == 2) islook = '未读';
                                $('.list').append(
                                    "<div style='width: 100%;height: 110px;border-bottom: 1px solid #eaf3ff'>" +
                                    "<div style='width: 20%;height: 100%;float: left;line-height: 110px'>" +
                                    "<div style='margin: 0 auto;width: 150px;font-size: 18px;height: 110px;text-indent: 60px;background: url(/images/message/qunzu.png) no-repeat left'>【群组】</div>" +
                                    "</div>" +
                                    "<div style='width: 60%;height: 100%;float: left'>" +
                                    "<div style='height: 70px;width: 100%;position: relative;top: 50%;transform:translateY(-50%)'>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #4e99ff;font-size: 16px;'>"+t.tasktime+"</div>" +
                                    "<div style='height: 35px;width: 100%;line-height: 40px;color: #444444;font-size: 16px;'>"+t.taskcontent+"</div>" +
                                    "</div>" +
                                    "</div>" +
                                    "<div style='width: 20%;height: 100%;float: left'>" +
                                    "<a href='?action="+t.action+"&proposalID="+t.proposalId+"&taskid="+t.id+"&lock=1'><div style='margin-right:30px;position: relative;top: 50%;transform: translateY(-50%);width: 80px;height: 35px;float: right;line-height: 35px;font-size: 16px;color: white;background-color: #4e99ff;text-align: center;border-radius: 4px'>查看</div></a>" +
                                    "<div style='position: relative; top: 50%;transform: translateY(-50%);font-size: 16px;height: 35px;line-height: 35px;color: #f48668;float: right;margin-right: 65px'>"+islook +"</div>" +
                                    "</div>" +
                                    "</div>"
                                );
                                break;
                        }
                    });
                    break;
            }


            if (res.size > 7){
                var size = Math.ceil(res.size/7);
                for(var i=0;i<size;i++){
                    if (i == 0){
                        $(".tablist").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }

                    if((i+1) == curentPage){
                        $(".tablist").append("<a href='?action="+$('.action_flag').attr('id')+"&mod="+mod+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }else {
                        $(".tablist").append("<a href='?action="+$('.action_flag').attr('id')+"&mod="+mod+"&page="+ (i+1) +"'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: #999;font-size: 14px;line-height: 30px;text-align: center;'>"+(i+1)+"</div></a>");
                    }

                    if ((i+1) == size){
                        $(".tablist").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                    }
                }
            }else {
                $(".tablist").append("<a><div class='tableft' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;margin-right: 10px;line-height: 30px;text-align: center;background-image: url(/images/wode/zuo.png);background-repeat: no-repeat;background-position: center'><></div></a>");
                $(".tablist").append("<a href='?action="+$('.action_flag').attr('id')+"&mod="+mod+"&page=1'><div class='datalist_item' style='margin-right: 10px;display: inline-block;width: 25px;height: 30px;background-color: #4e99ff;border: 1px solid #dcdcdc;border-radius: 2px;color: #fff;font-size: 14px;line-height: 30px;text-align: center;'>1</div></a>");
                $(".tablist").append("<a><div class='tabright' style='display: inline-block;width: 25px;height: 30px;background-color: white;border: 1px solid #dcdcdc;border-radius: 2px;color: transparent;font-size: 12px;line-height: 30px;text-align: center;background-image: url(/images/wode/you.png);background-repeat: no-repeat;background-position: center'><></div></a>");
            }


            $(".tableft").click(function () {
                getTaskList('last');
            });

            $(".tabright").click(function () {
                getTaskList('next');
            });

            getTaskCount();
        }else {
            alert(res.msg);
        }
    });
}


//获取最后num条任务数据
function api_getTaskListToNum(){
    $.getJSON('/api.php?action=api_getTaskListToNum',{'num':1},function (res) {
        if (res.code == 0){

        }else {

        }
    });
}

function showxgmidialog() {
    window.location.href = "?action=main&modifyPassword=1";
}

function  showbjzldialog() {
    window.location.href = "?action=main&userinfo=1";
}

function  showqhzhdialog() {
    /*$('.main_tilte_right_avtar').html(text);
    $('.main_url').css('display','none');*/
    window.location.href = "?action=login";
}

function showdialog() { $('.reuse_dialog').show(); }
function dissmissdialog(){ $('.reuse_dialog').hide(); }

/**
 * 修改密码
 */
function changePwd() {

    var id=$('.main_bottom_dialog_mima').attr('id');
    //密码
    var oldpaswword=$('.oldpwd').val();
    var newpaswword1=$('.newpwd_1').val();
    var newpaswword2=$('.newpwd_2').val();

    if(oldpaswword.length==0||newpaswword1.length==0||newpaswword2.length==0){
        $('.mima_error_dialog').css('visibility','visible');
        $('.mima_error_dialog').html('密码信息不能为空!!');

    }else if(newpaswword1!==newpaswword2){
        $('.mima_error_dialog').css('visibility','visible');
        $('.mima_error_dialog').html('新密码必须一致!!');

    }else if(newpaswword1.length<6||newpaswword2.length<6){
        $('.mima_error_dialog').css('visibility','visible');
        $('.mima_error_dialog').html('密码不能小于6位!!');
        /*setTimeout(function() {
                       $('.mima_error_dialog').css('visibility','hidden');
                   },2000);*/
    } else {
        var formData=new FormData();
        formData.append('userId',id);
        formData.append('oldpwd',oldpaswword);
        formData.append('newpwd',newpaswword1);
        $.ajax({
            url:"/api.php?action=api_getPwd",
            type:'POST',
            cache:false,
            data:formData,
            processData:false,
            contentType:false,
            dataType:'json',
            beforeSend:function () {
            },
            success:function (result) {
                if(result.code==0){
                    window.location.href="?action=main&success=1";
                }else {
                    $('.mima_error_dialog').css('visibility','visible');
                    $('.mima_error_dialog').html(result.msg);
                }
            }
        });
    }
}


/**
 * 发布公告
 */
function sendAnnouncement(){
    var title =  $('.announcement_title').val();
    var content =  $('.announcement_content').val();

    if(title.length == 0 || content.length == 0){
        alert('参数不能为空!')
        return;
    }

    var path = $(".mobileupload_announcement")[0].files;
    if (path.length != 0) {
        //有文件
        var formData = new FormData();
        var names = '';
        for (var i = 0, name; i < path.length; i++) {
            name = path[i].name.split('.')[0];
            formData.append(name, path[i]);
            if (i == path.length - 1) {
                names += name;
            } else {
                names += name + ',';
            }
        }
        formData.append('info', names);

        $.ajax({
            url: '/api.php?action=api_uploadFile',
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
            dataType: 'json',
            //发送前调用
            beforeSend: function(){
                $('.banli_error_dialog').css('visibility','visible');
            },
            //成功
            success: function(result)
            {
                if (result.code == 1){
                    $('.banli_error_dialog').html('上传失败!');
                }else {
                    //获取文件信息
                    var data = result.data;
                    var file_id = '';
                    for (var i=0;i<data.length;i++){
                        if (i == 0){
                            file_id += data[i].id;
                        }else {
                            file_id += (',' + data[i].id);
                        }
                    }

                    $.getJSON('/api.php?action=api_sendAnnouncement',
                    {'title':title,'content':content,'fileid':file_id},
                    function (res) {
                        if (res.code == 0){
                            //成功
                            window.location.href='?action=xinxi';
                        }else {
                            alert(res.msg);
                        }
                    });
                }
            },
            //失败
            error: function (result) {
                $('.banli_error_dialog').html('上传错误!');
            },
            //进度
            xhr: function(){
                var xhr = $.ajaxSettings.xhr();
                if(onprogress && xhr.upload) {
                    xhr.upload.addEventListener('progress' , onprogress, false);
                    return xhr;
                }
            }
        });

        //输出进度
        function onprogress(evt) {
            var loaded = evt.loaded;
            var tot = evt.total;
            $('.banli_error_dialog').html("正在上传:"+(Math.floor(100 * loaded / tot) + '%'));
        }
    }else {
        //无文件
        $.getJSON('/api.php?action=api_sendAnnouncement',
        {'title':title,'content':content},
        function (res) {
            if (res.code == 0){
                //成功
                window.location.href='?action=xinxi';
            }else {
                alert(res.msg);
            }
        });
    }
}

function searchUser() {
    var select_role = $('.select_role').text();//角色  span
    var select_jc = $('.select_jc').text();//届次  span
    var searchName = $('.searchName').val();//姓名
    var searchPhone = $('.searchPhone').val();//手机号

    if(select_role == '请选择'){
        select_role = '';
    }

    if(select_jc == '请选择'){
        select_jc = '';
    }
    
    window.location.href="?action=xitong&manager=2&select_role="+select_role+"&select_jc="+select_jc+"&searchName="+searchName+"&searchPhone="+searchPhone;

}

function clearSearchUser(){
    $('.select_role').html('请选择');
    $('.select_jc').html('请选择');
    $('.searchName').val('');
    $('.searchPhone').val('');
}



$(document).ready(function() {

    $('.allDlownload').click(function () {
        if(checkedList.length != 0){
            var str = '';
            if (checkedList.length == 1){
                str = checkedList[0];
            }else {
                for(x in checkedList){
                    if (x == (checkedList.length-1)){
                        str += checkedList[x];
                    }else {
                        str += checkedList[x]+',';
                    }
                }
            }
            window.location.href = "readorwrite.php?&downloadType=1&downloadID="+str;
        }
    });

    $('.exportUserInfo').click(function () {
        window.location.href = "readorwrite.php?&downloadType=2";
    });


    $('#tiancontent').redactor();
    $('#tianadvice').redactor();

    var isOpen = false;
    $(".zhankai").click(function () {
        if (isOpen){
            $(".zhankai-image").html("展开");
            $(".zhankai-image").css("background-image","url(/images/xinjian/zhankai.png)");
            $(".zhankai-image").css("background-repeat","no-repeat");
            $(".zhankai-image").css("background-position","45");
            $("#showContent").hide();
            isOpen = false;
        }else {
            $(".zhankai-image").html("收起");
            $(".zhankai-image").css("background-image","url(/images/xinjian/shouqi.png)");
            $(".zhankai-image").css("background-repeat","no-repeat");
            $(".zhankai-image").css("background-position","45");
            $("#showContent").show();
            isOpen = true;
        }
    });

    $(document).keyup(function(event){
        if(event.keyCode ==13){
            $(".login_button").trigger("click");
        }
    });

    /*$(".main_xiaoxi_a").click(
        function () {
            $(".main_bottom_dialog").css("display","block");
        }
    );*/

    $('.main_dialog_cuohao').click(
        function() {
            $(".main_bottom_dialog").css("display","none");
        }
    );

    $(".main_botton_left_text_no").mouseover(function() {
        $(this).css("background-color","#c3ddff");
        $(this).css("color","#3380fe");
    });

    //选择文件后
    $(".mobileupload").change(function (evt) {
        var path = $(".mobileupload")[0].files;
        for(var i= 0,name;i<path.length;i++){
            name = path[i].name.split('.')[0];
            $(".photo-list").prepend("<div class='file-item' style='color: white;font-size: 10px;width: 95px;height: 95px;float: left;margin-right: 1px;margin-top: 1px;margin-bottom: 1px;;background-color: #ffcf80;text-align: center'>"+name+"</div>");
        }
    });

    //信息中心重置
    $(".mobileupload_announcement").change(function (evt) {
        var path = $(".mobileupload_announcement")[0].files;
        for(var i= 0,name;i<path.length;i++){
            name = path[i].name.split('.')[0];
            $(".photo-list").prepend("<div class='file-item' style='color: white;overflow: hidden;line-height: 45px;font-size: 10px;width: 45px;height: 45px;float: left;margin-right: 1px;margin-top: 1px;margin-bottom: 1px;;background-color: #ffcf80;text-align: center'>"+name+"</div>");
        }
    });

    //选择图片后
    $(".shangchuan").change(function (evt) {
        var path = $(".shangchuan")[0].files;
        var objUrl = getObjectURL(path[0]) ;
        // $(".avatar-grid").attr("src", objUrl);
        $(".avatar-grid").css("background-image","url("+objUrl+")");

    });
    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) { // basics
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }
    $(".main_botton_left_text_no").mouseover(function() {
        $(this).css("background-color","#c3ddff");
        $(this).css("color","#3380fe");
    });

    $(".main_botton_left_text_no").mouseout(function() {
        $(this).css("background-color","transparent");
        $(this).css("color","#767878");
    });

    $(".circleChart").
    circleChart({
        size:157,
        text:0,
        color: "#4e99ff",
        textSize:true,
        startAngle:75,
        relativeTextSize: 1 / 7,
        onDraw: function(el, circle) {
            circle.text(Math.round(circle.value) + "%");
        }
    });



});